package edu.zut.cs.software.cms.module.teacher.dao;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/*
 *  @author 15869
 */

import edu.zut.cs.software.cms.base.dao.GenericDao;
import edu.zut.cs.software.cms.module.teacher.domain.Teacher;
/*
 * This is an interface extends GenericDao
 */
public interface TeacherDao extends GenericDao<Teacher,Long>{
	@Query(value="  SELECT COUNT(*) FROM `cms`.`t_teacher` WHERE `id`=?1 ",nativeQuery=true)
	int IfOneExist(@Param("id") Long id);
	
	@Query(value="  SELECT * FROM `cms`.`t_teacher` WHERE `id`=?1 ",nativeQuery=true)
	Teacher modifyById(@Param("id") Long id);
	
	
	@Query(value="  SELECT COUNT(*) FROM `cms`.`t_teacher` WHERE `username`=?1 ",nativeQuery=true)
	int IfOneExist(@Param("name") String name);

}
